From 5c3222e9a8f67c336cd6a5f2458b2792a6a265da Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Wed, 20 Jun 2007 15:03:39 +0100 Subject: [PATCH] x86/hvm: determine shared info format earlier. Latch guest shared info format when hypercall page is being set up rather than during an arbitrarily selected hypercall. Signed-off-by: Jan Beulich Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 367defdc32..570181e523 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -831,11 +831,24 @@ void hvm_update_guest_cr3(struct vcpu *v, unsigned long guest_cr3) hvm_funcs.update_guest_cr3(v); } +static void hvm_latch_shinfo_size(struct domain *d) +{ + /* + * Called from operations which are among the very first executed by + * PV drivers on initialisation or after save/restore. These are sensible + * points at which to sample the execution mode of the guest and latch + * 32- or 64-bit format for shared state. + */ + if ( current->domain == d ) + d->arch.has_32bit_shinfo = (hvm_guest_x86_mode(current) != 8); +} + /* Initialise a hypercall transfer page for a VMX domain using paravirtualised drivers. */ void hvm_hypercall_page_initialise(struct domain *d, void *hypercall_page) { + hvm_latch_shinfo_size(d); hvm_funcs.init_hypercall_page(d, hypercall_page); } @@ -1065,13 +1078,7 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg) break; case HVM_PARAM_CALLBACK_IRQ: hvm_set_callback_via(d, a.value); - /* - * Since this operation is one of the very first executed - * by PV drivers on initialisation or after save/restore, it - * is a sensible point at which to sample the execution mode of - * the guest and latch 32- or 64-bit format for shared state. - */ - d->arch.has_32bit_shinfo = (hvm_guest_x86_mode(current) != 8); + hvm_latch_shinfo_size(d); break; } d->arch.hvm_domain.params[a.index] = a.value; -- 2.30.2